package propertydemo.propertydemo.property;

import lombok.Data;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.io.Serializable;
import java.util.List;

/**
 * @Description:外部配置对象和属性
 * @Author: liujinsheng
 * @Date: 2021/7/19.
 */
@Configuration
@PropertySource("classpath:test.properties")
@ConfigurationProperties(prefix = "market")
@Data
@ToString
//对属性进行校验
@Validated
public class Market implements Serializable {

   private List<Curpairs> curpairs;

    //内部类
    @ToString
    public static  class  Curpairs{
        private  String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
